/*
 * @lc app=leetcode.cn id=70 lang=cpp
 *
 * [70] 爬楼梯
 */

// @lc code=start
class Solution
{
  public:
    int climbStairs(int n)
    {
        if (n == 1 || n == 2) {
            return n;
        }

        int a = 1;
        int b = 2;
        int i = 3;
        while (i++ <= n) {
            int tmp = b;
            b = a + b;
            a = tmp;
        }
        return b;
    }
};
// @lc code=end
